package com.zhuiyun.project.api.sysuser.service;

import com.zhuiyun.project.api.sysuser.entiy.SysUser;
import com.zhuiyun.project.api.sysuser.model.SysUserModel;
import com.zhuiyun.project.common.errorCode.CommonException;
import com.zhuiyun.project.common.response.CommonResult;
import com.zhuiyun.project.util.pageUtil.PageRequest;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @ClassName UserService
 * @Description 系统用户服务类
 * @Author zcy
 * @Date 2023/3/24 15:43
 **/
public interface SysUserService {
    /**
     * 通过登录名登录
     *
     * @param loginName
     * @return
     */
    SysUser getUserByLoginName(String loginName);

    /**
     * 通过邮箱查询用户
     *
     * @param emailAccount
     * @return
     */
    SysUser getUserByEmailAccount(String emailAccount);

    /**
     * 修改用户状态
     *
     * @param sysUser
     */
    void updateUserByLogin(SysUser sysUser);

    /**
     * 修改用户信息
     *
     * @param sysUserModel
     * @return
     */
    CommonResult updateUser(SysUserModel sysUserModel) throws CommonException;

    /**
     * 删除用户
     *
     * @param id
     * @return
     */
    CommonResult delUserById(Integer id) throws CommonException;

    /**
     * 分页查询
     *
     * @param sysUserModel
     * @param pageRequest
     * @return
     */
    CommonResult getUserByPage(SysUserModel sysUserModel, PageRequest pageRequest);

    /**
     * 根据手机号查询用户信息
     *
     * @param phoneAccount
     * @return
     */
    SysUser getUserByPhoneAccount(String phoneAccount);


    /**
     * 新增用户
     *
     * @param sysUserModel
     * @return
     */
    CommonResult saveUser(SysUserModel sysUserModel, MultipartFile avatar) throws CommonException;


    /**
     * @description: 查询注销的用户
     * @author: dongdong
     * @date: 2023/4/6 16:05
     * @param: [sysUserModel, pageRequest]
     * @return: com.zhuiYun.project.common.response.CommonResult
     **/
    CommonResult getUserRetrieveByPage(SysUserModel sysUserModel, PageRequest pageRequest);


    /**
     * @param userId
     * @param integers
     * @Author kdj
     * @Description 修改用户权限
     * @Date 2023/6/21 20:38
     * @Return com.zhuiyun.project.common.response.CommonResult
     */
    CommonResult userPower(Integer userId, List<Integer> integers);

    CommonResult getUserPower(Integer userId);

    CommonResult getPowerByUser();


    /**
     * @param id
     * @Author kdj
     * @Description 根据id查询
     * @Date 2023/6/13 16:03
     * @Return com.zhuiyun.project.common.response.CommonResult
     */
    SysUser getSysUserById(Integer id);

    /**
     * @param
     * @param sysUserModel
     * @Author kdj
     * @Description 修改用户头像
     * @Date 2023/6/13 17:20
     * @Return CommonResult
     */
    CommonResult updateUserFile(HttpServletRequest request, MultipartFile file, SysUserModel sysUserModel) throws CommonException;

    /**
     * @param mail
     * @Author kdj
     * @Description pc端邮箱是否存在
     * @Date 2023/6/14 9:30
     * @Return com.zhuiyun.project.api.sysuser.entiy.SysUser
     */
    SysUser checkMail(String mail);

    /**
     * @param phone
     * @Author kdj
     * @Description pc端手机号是否存在
     * @Date 2023/6/14 9:30
     * @Return com.zhuiyun.project.api.sysuser.entiy.SysUser
     */
    SysUser checkPhone(String phone);

    /**
     * @param sysUserModel
     * @Author kdj
     * @Description 修改用户密码
     * @Date 2023/6/14 10:17
     * @Return com.zhuiyun.project.common.response.CommonResult
     */
    CommonResult updatePassword(SysUserModel sysUserModel);

    /**
     * @param id
     * @param password
     * @Author kdj
     * @Description 判断密码是否一致
     * @Date 2023/6/14 10:56
     * @Return com.zhuiyun.project.common.response.CommonResult
     */
    CommonResult checkOldPassword(Integer id, String password);


    /**
     * @Author 小江
     * @Description //TODO 修改用户信息 管理员改
     * @Date 15:03 2023/8/12
     **/
    CommonResult updateUserByPc(SysUserModel sysUserModel, MultipartFile avatar);
}
